/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author lab1
 */
@Entity
@Table(name = "products")
@NamedQueries({
    @NamedQuery(name = "Product2.findAll", query = "SELECT p FROM Product2 p"),
    @NamedQuery(name = "Product2.findByProductID", query = "SELECT p FROM Product2 p WHERE p.productID = :productID"),
    @NamedQuery(name = "Product2.findByProductName", query = "SELECT p FROM Product2 p WHERE p.productName = :productName"),
    @NamedQuery(name = "Product2.findByPrice", query = "SELECT p FROM Product2 p WHERE p.price = :price"),
    @NamedQuery(name = "Product2.findByPicturPath", query = "SELECT p FROM Product2 p WHERE p.picturPath = :picturPath")})
public class Product2 implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ProductID")
    private String productID;
    @Column(name = "ProductName")
    private String productName;
    @Column(name = "Price")
    private Double price;
    @Column(name = "PicturPath")
    private String picturPath;
    @OneToMany(mappedBy = "product2")
    private List<Order2> order2List;

    public Product2() {
    }

    public Product2(String productID) {
        this.productID = productID;
    }

    public String getProductID() {
        return productID;
    }

    public void setProductID(String productID) {
        this.productID = productID;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public String getPicturPath() {
        return picturPath;
    }

    public void setPicturPath(String picturPath) {
        this.picturPath = picturPath;
    }

    public List<Order2> getOrder2List() {
        return order2List;
    }

    public void setOrder2List(List<Order2> order2List) {
        this.order2List = order2List;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (productID != null ? productID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Product2)) {
            return false;
        }
        Product2 other = (Product2) object;
        if ((this.productID == null && other.productID != null) || (this.productID != null && !this.productID.equals(other.productID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Product2[productID=" + productID + "]";
    }

}
